﻿Imports System.Windows.Forms

Public Class QuickSet
    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        StreamerMatch.lblplr1.Text = TextBox1.Text
        StreamerMatch.lblplr2.Text = TextBox2.Text
        'color
        Dim usecolor1 As Color = TextBox1.ForeColor
        Dim usecolor2 As Color = TextBox2.ForeColor
        If My.Settings.colorType = 1 Then
            StreamerMatch.lblplr1.ForeColor = usecolor1
            StreamerMatch.lblplr2.ForeColor = usecolor2
        ElseIf My.Settings.colorType = 2 Then
            If Not TextBox1.ForeColor = StreamerMatch.lblScoreOnelbl.ForeColor Then
                StreamerMatch.btnplrcolor1.Visible = True
                StreamerMatch.btnplrcolor1.BackColor = usecolor1
            End If
            If Not TextBox2.ForeColor = StreamerMatch.lblScoreOnelbl.ForeColor Then
                StreamerMatch.btnplrcolor2.Visible = True
                StreamerMatch.btnplrcolor2.BackColor = usecolor2
            End If
        End If
        ' races
        'p,t,z,r
        If Button9.BackColor = Color.LightSkyBlue Then
            StreamerMatch.Button1.BackgroundImage = StreamerMatch.activePic.Images.Item(0)
        ElseIf Button10.BackColor = Color.LightSkyBlue Then
            StreamerMatch.Button1.BackgroundImage = StreamerMatch.activePic.Images.Item(1)
        ElseIf Button11.BackColor = Color.LightSkyBlue Then
            StreamerMatch.Button1.BackgroundImage = StreamerMatch.activePic.Images.Item(2)
        ElseIf Button12.BackColor = Color.LightSkyBlue Then
            StreamerMatch.Button1.BackgroundImage = StreamerMatch.activePic.Images.Item(3)
        End If

        If Button21.BackColor = Color.LightSkyBlue Then
            StreamerMatch.Button2.BackgroundImage = StreamerMatch.activePic.Images.Item(0)
        ElseIf Button22.BackColor = Color.LightSkyBlue Then
            StreamerMatch.Button2.BackgroundImage = StreamerMatch.activePic.Images.Item(1)
        ElseIf Button23.BackColor = Color.LightSkyBlue Then
            StreamerMatch.Button2.BackgroundImage = StreamerMatch.activePic.Images.Item(2)
        ElseIf Button24.BackColor = Color.LightSkyBlue Then
            StreamerMatch.Button1.BackgroundImage = StreamerMatch.activePic.Images.Item(3)
        End If

        If Not My.Settings.Playernames.Contains(TextBox1.Text) Then
            My.Settings.Playernames.Add(TextBox1.Text)
        End If
        If Not My.Settings.Playernames.Contains(TextBox2.Text) Then
            My.Settings.Playernames.Add(TextBox2.Text)
        End If

        StreamerMatch.textFade(StreamerMatch.lblplr1)
        StreamerMatch.textFade(StreamerMatch.lblplr2)

        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()

        My.Settings.quickSetPosition = Me.Location
    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button2.Click, Button3.Click, Button4.Click, Button5.Click, Button6.Click, Button7.Click, Button8.Click
        TextBox1.ForeColor = sender.Backcolor
        TextBox1.BackColor = Color.Black
    End Sub

    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click, Button14.Click, Button15.Click, Button16.Click, Button17.Click, Button18.Click, Button19.Click, Button20.Click
        TextBox2.ForeColor = sender.Backcolor
        TextBox2.BackColor = Color.Black
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click, Button10.Click, Button11.Click, Button12.Click
        Button9.BackColor = Me.BackColor
        Button10.BackColor = Me.BackColor
        Button11.BackColor = Me.BackColor
        Button12.BackColor = Me.BackColor
        sender.Backcolor = Color.LightSkyBlue
    End Sub

    Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button21.Click, Button22.Click, Button23.Click, Button24.Click
        Button21.BackColor = Me.BackColor
        Button22.BackColor = Me.BackColor
        Button23.BackColor = Me.BackColor
        Button24.BackColor = Me.BackColor
        sender.Backcolor = Color.LightSkyBlue
    End Sub

    Private Sub QuickSet_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim a As New AutoCompleteStringCollection
        For Each s As String In My.Settings.Playernames
            a.Add(s)
        Next
        TextBox1.AutoCompleteCustomSource = a
        TextBox2.AutoCompleteCustomSource = a
        TextBox1.Focus()
    End Sub
End Class
